{% include 'front/header.html' %}
<link rel="stylesheet" href="/resource/front/css/login.css" />
<style>
	.true-wrap1 {
		width: 80%;
		height: 90%;
		text-align: center;
		display: none;
		background: #fff;
		z-index: 1001;
		margin: auto;
		margin-top: 0.666666rem;
	}
	body{
		overflow: hidden;
	}
</style>
</head>

<body>
	<div class="user-con">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back">
				<!--<img src="/resource/front/img/图层9.png" class="close" />-->
			</a>
			<h1 class="mui-title">登录/注册</h1>
		</header>
		<div id="" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0;    z-index: -1;overflow: hidden;">
				<img src="/resource/front/img/blur-book-stack-books-590493.png" style="width: 100%;" onclick="return false" />
			</div>
		<div id="content-box" style="    height: 100%;padding-top: 5rem; position: relative;">
			
			<div class="login-bottom-wrap div-tab">
				<div class="phone input-wrap input1">
					<input type="number" id="phone" data-type="tel" field="mobile" required="true" errmsg="请输入正确的手机号码" style="width: 55%; margin-bottom: 0;" placeholder="请输入您的手机号码">
					<div id="getcode">获取验证码</div>
				</div>
				<div class="phone input-wrap">
					<input type="number" id="phone" field="yzm" required="true" errmsg="请输入验证码" style="width: 65%; margin-bottom: 0;" placeholder="输入验证码">
				</div>
				<p class="go-login login"> <!--<span class="mmlogin">密码登录</span>--><span class="forget">未注册用户登陆后自动注册</span></p>
				<button class="res-q" id="go-login">登录</button>
				
			</div>
			<p class="sm"  ><span id="check2">龙采头条软件负责声明</span><span class="check"></span></p>
		</div>
		
		<div class="xy" style="position: fixed;top: 0;right: 0;left: 0;bottom: 0; display: none;z-index: 999;">
			<img class="close1" src="/resource/front/img/delete.png" style="z-index: 1002; position: absolute;top: calc(0.666666rem - 10px); right: calc(10% - 10px);width: 20px;" />
			<div class="true-wrap1" style="display: block; overflow-y: auto;">
				<img src="/resource/front/img/ys/img_privacy1.png" alt="" class="" style="width: 100%;">
				<img src="/resource/front/img/ys/img_privacy1.png" alt="" class="" style="width: 100%;">
			</div>
		</div>
		<div class="js_dialog" style="opacity: 1;display: none; ">
			<div class="weui-mask"></div>
		</div>
	</div>
</body>

</html>
{% include 'front/foot1.html' %}
<script type="text/javascript" src="/resource/front/js/jquery.lazyload.min.js"></script>
<script>
	defineClass('init', {
		init: function() {
			var it = this;
			it.params = util.GetRequest(); //获取传参
			it.login();
			it.countdown = 59; //倒计时
			$('.mmlogin').click(function() {
				window.history.go(-1)
			})
			it.getImg();

			$('#getcode').on('click', function() {
				it.getCode('#getcode', '#phone');
			})

			$('.check').click(function() {
				$(this).hasClass('is-check') ? $(this).removeClass('is-check') : $(this).addClass('is-check')
			})
			var mask = mui.createMask(function () {
				console.log(1)
			});
			$('#check2').click(function() {
				mask.show();
				$('.xy').show();
				document.body.style.overflow = 'hidden';
			})
			$('.close1').click(function() {
				mask.close();
				$('.xy').hide();
				document.body.style.overflow = 'auto';
			})
			$('#content-box').css('height',document.body.clientHeight)
//			$('.user-con').css('height',document.body.clientHeight)
			var  input = document.getElementById('input')
	            input.addEventListener('focus', function () {
	                setInterval(function () {
	                // 核心
	                    input.scrollIntoView(false);
	                }, 200)
	            })
	            var input1 = document.getElementById('input1')
	            input.addEventListener('focus', function () {
	                setInterval(function () {
	                // 核心
	                    input1.scrollIntoView(false);
	                }, 200)
	            })
//			document.body.style.height = document.body.clientHeight+'px';
			$('.user-con').css('height',document.body.clientHeight)
		},
		getImg:function(){
			var html = "";
			for(var i = 0; i < 14; i ++){
				html += '<img class="lazy" data-original="/resource/front/img/ys/img_privacy'+(i+1)+'.png" alt="" class="" style="width: 95%;margin:0 auto;">'
			}
			$('.true-wrap1').html(html);
			$("img.lazy").lazyload({
				effect: "fadeIn"
			});
		},
		login: function() {
			var it = this;
			$('#go-login').click(function() {
				var data = util.getFormCode({
					el: ".login-bottom-wrap"
				});

				if(data) {
					if(it.params.be_invite) {
						data['be_invite'] = it.params.be_invite
					}
					data.imei = Math.random();
					if(!$('.check').hasClass('is-check')) {
						mui.toast("请同意已阅读声明");
						return false;
					}
					util.doAjax({
						url: "/api/user/login",
						method: "post",
						data: data,
						success: function(res) {
							if(res.status == 'success') {
								mui.toast(res.msg);
								setTimeout(function() {
									if(mui.os.android) {
										window.location.href = 'http://zhushou.360.cn/detail/index/soft_id/3968740';
									} else if(mui.os.ios) {
										window.location.href = 'https://itunes.apple.com/us/app/职尺校园/id1320720197?l=zh&ls=1&mt=8';
									} else {
										window.location.href = 'http://www.52qingqiyun.com/app/';
									}
								})
							} else {
								mui.toast(res.msg);
							}
						}
					})
				}
			})
		},
		getCode: function(el, textEl) {
			var that = this;
			var phone = el == "#getcode1" ? "#phoner" : "#phone";
			if($(phone).val() && /^1(3|4|5|7|8|9)\d{9}$/.test($(phone).val())) {
				if(that.time) {
					return;
				}
				util.doAjax({
					url: "/api/user/sent_msg",
					method: "post",
					data: {
						mobile: $(phone).val()
					},
					success: function(res) {
						mui.toast(res.msg);
					}
				})

				that.time = setInterval(() => {
					that.settime(el);
				}, 1000);
			} else {
				mui.toast("请输入正确的手机号码");
			}
		},

		settime: function(el) {
			var that = this;
			if(that.countdown == 0) {
				$(el).text("获取验证码");
				that.countdown = 60;
				clearInterval(that.time);
				that.time = "";
			} else {
				$(el).text("重新发送(" + that.countdown + ")");
				that.defaultText = "重新发送(" + that.countdown + ")";
				that.countdown--;
			}
		}
	})
</script>